package com.sdp.right.control;


import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.sdp.core.bizc.db.Query;
import com.sdp.core.bizc.db.QueryColumn;
import com.sdp.core.bizc.threadLocal.ContextManager;
import com.sdp.core.bizc.utils.CoreConstantsEnum;
import com.sdp.core.bizc.vo.DataCenter;
import com.sdp.core.bizc.vo.Result;
import com.sdp.right.db.sys_flow_current_task.service.ISysFlowCurrentTaskService;
import com.sdp.right.entity.SysFlowCurrentTask;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zsp
 * @since 2024-07-18
 */
@RestController
@RequestMapping("/SysFlowCurrentTaskController")
public class SysFlowCurrentTaskController {

	@Autowired
	private ISysFlowCurrentTaskService iSysFlowCurrentTaskService;
	
	@Autowired
	private Query query;
	
	@PostMapping(value = "/page")
	public Result<?> page(@RequestBody DataCenter dataCenter) {
		List<QueryColumn> queryForm = new ArrayList<QueryColumn>();
		if(dataCenter.getQueryForm()==null) {
			dataCenter.setQueryForm(queryForm);
		}else {
			queryForm = dataCenter.getQueryForm();
		}
		QueryColumn systemNoColumn = new QueryColumn();
		systemNoColumn.setField("systemNo");
		systemNoColumn.setVal(ContextManager.getContextData(CoreConstantsEnum.header中的模块参数名.getCode()));
		queryForm.add(systemNoColumn);
		QueryColumn empColumn = new QueryColumn();
		empColumn.setField("approvalEmpNo");
		empColumn.setVal(ContextManager.getContextData(CoreConstantsEnum.token中工号的属性名.getCode()));
		queryForm.add(empColumn);
		return Result.ok(query.page(iSysFlowCurrentTaskService, SysFlowCurrentTask.class, dataCenter));
	}
}

